<?php $uClass   = $sf_params->get('uClass') ?>
<?php $dbClass  = $sf_params->get('dbClass') ?>
<?php $stcClass = $sf_params->get('stcClass') ?>
<?php $ns       = $sf_params->get('ns') ?>

<?php $show_toggle  = isset($show_toggle)   ? $show_toggle   : true ?>
<?php $autocomplete = isset($autocomplete) ? $autocomplete : 'on' ?>

<?php $object = method_exists($form, 'getObject') ? $form->getObject() : null ?>
<?php $parent = isset($parent) ? $parent : null ?>

<?php if (!isset($action)): ?>
  <?php $action = $object->isNew() ? 'Agregar' : 'Editar' ?>
<?php endif; ?>

<?php $hiddens = isset($hiddens) ? $hiddens : array('id') ?>

<?php $title  = isset($title)  ? $title  : sfInflector::humanize($uClass) ?>
<?php $titles = isset($titles) ? $titles : $title ?>

<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>

<h2><?php echo $title ?></h2>
<p><?php echo $titles ?></p>

<?php if (has_slot('error_summary')): ?>
<div class="errorExplanation" id="errorExplanation">
  <?php include_slot('error_summary') ?>
</div>
<?php endif; ?>

<?php if (!isset($action_url)): ?>
  <?php $action = $object->isNew() ? 'Agregar' : 'Editar' ?>
  <?php if (isset($routing)): ?>
    <?php $action_url = isset($parent) ? sprintf('@%s?slug=%s', $routing, $parent->getSlug()) : sprintf('@%s', $routing) ?>
  <?php else: ?>
    <?php $action_url = !$object->isNew() ? sprintf('@%s_editar?slug=%s', $uClass, $object->getSlug()) : (!$parent ? sprintf('@%s_nuevo', $uClass) : sprintf('@%s_nuevo?parent_slug=%s', $uClass, $parent->getSlug())) ?>
  <?php endif; ?>
<?php endif; ?>
                    
<?php $action_url = url_for($action_url) ?>
                      
<?php if (has_slot('extra_top')): ?>
  <?php include_slot('extra_top') ?>
<?php endif; ?>
           
<form name="<?php echo $uClass ?>" action="<?php echo $action_url ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?> >

<?php include_partial
      (
        'Crud/form', 
        get_objective_vars(get_defined_vars())
      )
?>
<?php include_partial('Crud/buttons_edit', array('object' => $object)) ?>
<?php if (has_slot('extra')): ?>
  <?php include_slot('extra') ?>
<?php endif; ?>
</form>